package com.hxzy.tms.dao.impl;

import java.util.List;

import com.hxzy.tms.dao.HibernateBaseDao;
import com.hxzy.tms.dao.ProjectDao;
import com.hxzy.tms.entity.Project;

public class DefaultProjectDao extends HibernateBaseDao<Project> implements ProjectDao {
    @SuppressWarnings({ "deprecation", "unchecked" })
    public List<Project> readMyProject(Long user) {
        String sql = "SELECT * FROM project INNER JOIN user_task ut ON project.id=ut.project_id WHERE ut.user_id="
                + user + "";
        List<Project> query = getSession().createSQLQuery(sql).addEntity(Project.class).list();
        return query;
    }

    @SuppressWarnings({ "unchecked", "deprecation" })
    public List<Project> readTeamProject(Long team) {
        String sql = "select * from project where team_id=" + team + "";
        List<Project> query = (List<Project>) getSession().createSQLQuery(sql).addEntity(Project.class).list();
        return query;
    }
}
